package com.serli.sample.data.runner.domain;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name= "RELEVE" )
@NamedQueries({
    @NamedQuery(name = DataRecord.FIND_ALL_ORDER_BY_DATE, query = "SELECT s FROM DataRecord s ORDER BY s.date")
})
public class DataRecord {
	
    public static final String FIND_ALL_ORDER_BY_DATE = "findAllOrderByDate";
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "ID_RELEVE")
	private long id;
	
	@JoinColumn(name="ID_CIRCUIT", referencedColumnName="ID_CIRCUIT", nullable=false)	
	@OneToOne(fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE })
	private Trip trip;

	@JoinColumn(name="ID_COUREUR", referencedColumnName="ID_COUREUR")	
	@OneToOne(fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE })
	private Runner runner;
	
	@Temporal(TemporalType.TIME)
	@Column(name = "DUREE", nullable = false)
	private Date raceTime;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "DATE_DEPART", nullable = false)
	private Date date;
	
	@Temporal(TemporalType.TIME)
	@Column(name = "HEURE_DEPART")
	private Date time;
	
	@Basic
	@Column(name = "DISTANCE", columnDefinition="decimal(6,2)")
	private float distance;
	
	@Basic
	@Column(name = "VITESSE", columnDefinition="decimal(4,2)")
	private float speed;
	
	@Basic
	@Column(name = "VITESSE_MAX", columnDefinition="decimal(4,2)")
	private float speedMax;
	
	@Basic
	@Column(name = "VITESSE_CIBLE", columnDefinition="decimal(4,2)")
	private float speedTarget;
	
	@Temporal(TemporalType.TIME)
	@Column(name = "VITESSE_IN")
	private Date speedIn;
	
	@Temporal(TemporalType.TIME)
	@Column(name = "VITESSE_LO")
	private Date speedLo;
	
	@Temporal(TemporalType.TIME)
	@Column(name = "VITESSE_HI")
	private Date speedHi;
	
	@Basic
	@Column(name = "HRM")
	private short hrm;
	
	@Basic
	@Column(name = "HRM_MAX")
	private short hrmMax;
	
	@Basic
	@Column(name = "HRM_CIBLE")
	private float hrmTarget;
	
	@Temporal(TemporalType.TIME)
	@Column(name = "HRM_IN")
	private Date hrmIn;
	
	@Temporal(TemporalType.TIME)
	@Column(name = "HRM_LO")
	private Date hrmLo;
	
	@Temporal(TemporalType.TIME)
	@Column(name = "HRM_HI")
	private Date hrmHi;
	
	@Basic
	@Column(name = "NB_PAS")
	private int steps;
	
	@Basic
	@Column(name = "CALORIES")
	private short calories;
	
	@Basic
	@Column(name = "LAP")
	private short lap;
	
	@Basic
	@Column(name = "LAP_MAX")
	private short lapMax;
	
	@Basic
	@Column(name = "TEMPERATURE")
	private short temperature;
	
	@Enumerated(EnumType.STRING)
	private Weather weather;

	public Trip getTrip() {
		return trip;
	}

	public void setTrip(Trip trip) {
		this.trip = trip;
	}

	public Runner getRunner() {
		return runner;
	}

	public void setRunner(Runner runner) {
		this.runner = runner;
	}

	public Date getRaceTime() {
		return raceTime;
	}

	public void setRaceTime(Date raceTime) {
		this.raceTime = raceTime;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public float getDistance() {
		return distance;
	}

	public void setDistance(float distance) {
		this.distance = distance;
	}

	public float getSpeed() {
		return speed;
	}

	public void setSpeed(float speed) {
		this.speed = speed;
	}

	public float getSpeedMax() {
		return speedMax;
	}

	public void setSpeedMax(float speedMax) {
		this.speedMax = speedMax;
	}

	public float getSpeedTarget() {
		return speedTarget;
	}

	public void setSpeedTarget(float speedTarget) {
		this.speedTarget = speedTarget;
	}

	public Date getSpeedIn() {
		return speedIn;
	}

	public void setSpeedIn(Date speedIn) {
		this.speedIn = speedIn;
	}

	public Date getSpeedLo() {
		return speedLo;
	}

	public void setSpeedLo(Date speedLo) {
		this.speedLo = speedLo;
	}

	public Date getSpeedHi() {
		return speedHi;
	}

	public void setSpeedHi(Date speedHi) {
		this.speedHi = speedHi;
	}

	public short getHrm() {
		return hrm;
	}

	public void setHrm(short hrm) {
		this.hrm = hrm;
	}

	public short getHrmMax() {
		return hrmMax;
	}

	public void setHrmMax(short hrmMax) {
		this.hrmMax = hrmMax;
	}

	public float getHrmTarget() {
		return hrmTarget;
	}

	public void setHrmTarget(float hrmTarget) {
		this.hrmTarget = hrmTarget;
	}

	public Date getHrmIn() {
		return hrmIn;
	}

	public void setHrmIn(Date hrmIn) {
		this.hrmIn = hrmIn;
	}

	public Date getHrmLo() {
		return hrmLo;
	}

	public void setHrmLo(Date hrmLo) {
		this.hrmLo = hrmLo;
	}

	public Date getHrmHi() {
		return hrmHi;
	}

	public void setHrmHi(Date hrmHi) {
		this.hrmHi = hrmHi;
	}

	public int getSteps() {
		return steps;
	}

	public void setStep(int steps) {
		this.steps = steps;
	}

	public short getCalories() {
		return calories;
	}

	public void setCalories(short calories) {
		this.calories = calories;
	}

	public short getLap() {
		return lap;
	}

	public void setLap(short lap) {
		this.lap = lap;
	}

	public short getLapMax() {
		return lapMax;
	}

	public void setLapMax(short lapMax) {
		this.lapMax = lapMax;
	}

	public short getTemperature() {
		return temperature;
	}

	public void setTemperature(short temperature) {
		this.temperature = temperature;
	}

	public Weather getWeather() {
		return weather;
	}

	public void setWeather(Weather weather) {
		this.weather = weather;
	}

	public long getId() {
		return id;
	}
}
